import View from './View'
import Img from './Img'
import Node from './Node'

class World{
    constructor(ctx, width = 375, height = 667){
        Object.defineProperties(this, {
            tag: {
                value: 'world'
            },
            ctx: {
                value: ctx
            },
            width: {
                value: width,
                writable: true
            },
            height: {
                value: height,
                writable: true
            },
            children: {
                value: []
            }
        })
    }
    create(options) {
        return View.prototype.create.call(this, options)
    }
    removeChild(child) {
		return Node.prototype.removeChild.call(this, child)
    }
    find(selector){
        return Node.prototype.find.call(this, selector)
    }
    clear() {
		this.children.splice(0, this.children.length)
	}
    render(){
        this.children.forEach(child => {
            child.render(this.ctx)
        })
    }
}

export default World